using Millboard
using Base.Test

set_table_mode(:grid_tables)

board = []
@test """
""" == table(board) |> string


board = [11 12 13; 21 22 23]
@test """
+---+----+----+----+
|   |  1 |  2 |  3 |
+===+====+====+====+
| 1 | 11 | 12 | 13 |
+---+----+----+----+
| 2 | 21 | 22 | 23 |
+---+----+----+----+""" == table(board) |> string


board = ([1 2], [5 6;7 8], [9 10; 11 12])
@test """
+---+-------+
|   |     1 |
+===+=======+
| 1 |   1 2 |
+---+-------+
|   |   5 6 |
| 2 |   7 8 |
+---+-------+
|   |  9 10 |
| 3 | 11 12 |
+---+-------+""" == table(board) |> string

@test """
+---+--------+
|   | result |
+===+========+
| x |    1 2 |
+---+--------+
|   |    5 6 |
| y |    7 8 |
+---+--------+
|   |   9 10 |
| z |  11 12 |
+---+--------+""" ==
  table(board, colnames=["result"], rownames=["x", "y", "z"]) |> string


board = ([1 2], [5 6;7 8], [9 10; 11 12])
@test """
+---+-------+
|   |     1 |
+===+=======+
| 1 |   1 2 |
+---+-------+
|   |   5 6 |
| 2 |   7 8 |
+---+-------+
|   |  9 10 |
| 3 | 11 12 |
+---+-------+""" == table(board) |> string


board = ([], [5 6;7 8], [9 10; 11 12])
@test """
+---+-------+
|   |     1 |
+===+=======+
| 1 |       |
+---+-------+
|   |   5 6 |
| 2 |   7 8 |
+---+-------+
|   |  9 10 |
| 3 | 11 12 |
+---+-------+""" == table(board) |> string


board = ([1 2;3 4], [5 6;7 8], [9 10; 11 12])
@test """
+---+-------+
|   |     1 |
+===+=======+
|   |   1 2 |
| 1 |   3 4 |
+---+-------+
|   |   5 6 |
| 2 |   7 8 |
+---+-------+
|   |  9 10 |
| 3 | 11 12 |
+---+-------+""" == table(board) |> string
